import TodoList from "../pages/todo/TodoList.svelte";
import TodoDetail from "../pages/todo/TodoDetail.svelte";
import About from "../pages/About.svelte";
import NotFound from "../pages/NotFound.svelte";
import Forbidden from "../pages/Forbidden.svelte";
import Login from "../pages/auth/Login.svelte";
import Register from "../pages/auth/Register.svelte";
import Admin from "../pages/admin/Admin.svelte";

export const routes = [
  {
    path: "/register",
    component: Register,
    name: "登录",
    public: true,
    show: false,
  },
  { path: "/login", component: Login, name: "登录", public: true, show: false },
  {
    path: "/",
    component: TodoList,
    name: "首页",
    roles: ["user", "admin"],
    show: true,
  },
  {
    path: "/todos",
    component: TodoList,
    name: "任务列表",
    roles: ["user", "admin"],
    show: true,
  },
  {
    path: "/todos/:id",
    component: TodoDetail,
    name: "任务详情",
    roles: ["user", "admin"],
    show: false,
  },
  {
    path: "/about",
    component: About,
    name: "关于",
    roles: ["user", "admin"],
    show: true,
  },
  {
    path: "/admin",
    component: Admin,
    name: "管理员",
    roles: ["admin"],
    show: true,
  },
  {
    path: "/403",
    component: Forbidden,
    name: "无权访问",
    public: true,
    show: false,
  },
  { path: "*", component: NotFound, name: "404", public: true, show: false },
];
